package org.example.context;

import lombok.Getter;
import lombok.Setter;
import org.example.constant.OcrItem;
import org.example.gui.CaptureScreen;
import org.example.service.OcrService;

/**
 * 应用上下文
 */
@Getter
@Setter
public class OcrApplicationContext {

    /**
     * 初始化应用上下文
     */
    private static OcrApplicationContext context = new OcrApplicationContext();

    /**
     * 当前选中识别方案
     */
    private OcrItem ocrItem = OcrItem.DEFAULT;
    /**
     * 具体服务操作
     */
    private OcrService ocrService;
    /**
     * gui窗体信息
     */
    private CaptureScreen frame;


    private OcrApplicationContext() {
    }

    public static OcrApplicationContext context() {
        return OcrApplicationContext.context;
    }

    public static OcrApplicationContext setFrame(CaptureScreen frame) {
        OcrApplicationContext.context.frame = frame;
        return OcrApplicationContext.context;
    }

    public static OcrApplicationContext setOcrItem(OcrItem ocrItem) {
        OcrApplicationContext.context.ocrItem = ocrItem;
        return OcrApplicationContext.context;
    }

    public static OcrApplicationContext setOcrService(OcrService ocrService) {
        OcrApplicationContext.context.ocrService = ocrService;
        return OcrApplicationContext.context;
    }
}
